import 'package:flex_color_scheme/flex_color_scheme.dart';
import 'package:flutter/material.dart';
import 'package:xim/common/get_style_view.dart';
import 'package:xim/common/style/colors.dart';

/// 主题配置
class ThemeConfig {

  static ThemeData get theme => FlexThemeData.light(
    scheme: FlexScheme.bahamaBlue,
    surfaceMode: FlexSurfaceMode.levelSurfacesLowScaffold,
    blendLevel: 7,
    subThemesData: const FlexSubThemesData(
      blendOnLevel: 10,
      blendOnColors: false,
      useTextTheme: true,
      useM2StyleDividerInM3: true,
      alignedDropdown: true,
      useInputDecoratorThemeInDialogs: true,
    ),
    visualDensity: FlexColorScheme.comfortablePlatformDensity,
    useMaterial3: true,
    swapLegacyOnMaterial3: true,
  );

  static ThemeData get darkTheme => FlexThemeData.dark(
    scheme: FlexScheme.bahamaBlue,
    surfaceMode: FlexSurfaceMode.levelSurfacesLowScaffold,
    blendLevel: 13,
    subThemesData: const FlexSubThemesData(
      blendOnLevel: 20,
      useTextTheme: true,
      useM2StyleDividerInM3: true,
      alignedDropdown: true,
      useInputDecoratorThemeInDialogs: true,
    ),
    visualDensity: FlexColorScheme.comfortablePlatformDensity,
    useMaterial3: true,
    swapLegacyOnMaterial3: true,
  );

}

class StyleConfig extends IModelColor {
  static final font = _FontStyleConfig();
  static final btn = _BtnStyleConfig();

  @override
  List<ModelColor> get modelColors => [...font.modelColors, ...btn.modelColors];
}

class _FontStyleConfig extends IModelColor {
  ModelColor active =
      ModelColor(darkColor: const Color(0xff1989fa), lightColor: const Color(0xff1989fa));

  @override
  List<ModelColor> get modelColors => [active];
}

class _BtnStyleConfig extends IModelColor {
  final ModelColor defaultColor =
      ModelColor(darkColor: const Color(0xffffffff), lightColor: const Color(0xffffffff));
  final ModelColor primaryColor =
      ModelColor(darkColor: const Color(0xff07c160), lightColor: const Color(0xff07c160));
  final ModelColor infoColor =
      ModelColor(darkColor: const Color(0xff1989fa), lightColor: const Color(0xff1989fa));
  final ModelColor dangerColor =
      ModelColor(darkColor: const Color(0xffee0a24), lightColor: const Color(0xffee0a24));
  final ModelColor warningColor =
      ModelColor(darkColor: const Color(0xffff976a), lightColor: const Color(0xffff976a));

  @override
  List<ModelColor> get modelColors => [
        defaultColor,
        primaryColor,
        infoColor,
        dangerColor,
        warningColor,
      ];
}
